package yr.website

import grails.transaction.Transactional

@Transactional
class JobbService {

    def Boolean add(String name, String require) {
        def flag = true
        def job = new Jobb()
        job.name = name
        job.require = require
        job.releaseTime = new Date()
        job.state = true
        job.save()
        if (!job.save()) {
            job.errors.allErrors.each {
                println it
            }
            flag = false
        }
        return flag
    }

    def Boolean save(Jobb job) {
        def flag = true
        job.save()
        if (!job.save()) {
            job.errors.allErrors.each {
                println it
            }
            flag = false
        }
        return flag
    }

    def del(Integer id) {
        def job = Jobb.findById(id)
        job.delete()
    }
}
